const mongoose = require('mongoose');

let orderSchema = new mongoose.Schema({
    user: { // 关联用户
        type: mongoose.Schema.Types.ObjectId,
        ref: "userModel"
    },
    itemInfo: { // 商品快照
        type: mongoose.Schema.Types.ObjectId,
        ref: "shotModel"
    },
    finishTime: String, // 完成交易时间
    totalPrice: Number, // 总价
    count: Number, // 商品数量
    status: Number, // 订单状态
    startTime: String, // 下单时间
    receiveAddr: String, // 收货时间
    remarks: String, // 备注
    receivePhone: Number, // 收货人手机号
    receiveName: String // 收货人姓名
})

module.exports = mongoose.model('orderModel', orderSchema, 'order');